﻿using AbpToDomain.EntityInfo;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;

namespace AbpToDomain.EntityInfo
{
    //仓库
    public class Warehouse : Entity
    {
        [Key]
        public Guid Id_Warehouse {  get; set; }
        [Comment("仓库号")]
        public string WarehouseCode {  get; set; }
        [Comment("排")]
        public int Xaxis {  get; set; }
        [Comment("高")]
        public int Yaxis { get; set; }
        [Comment("列")]
        public int Zaxis {  get; set; }
        public DateTime CreatTime { get; set; }
        public DateTime? UpdateTime { get; set; }
        public override object[] GetKeys()
        {
            return new object[] { Id_Warehouse };
        }
        //foreignkey
        public List<WarehouseLine>? warehouselines { get; set; }=new List<WarehouseLine>();

  
        //function
        public Warehouse AddWarehouse(string WarehouseCode,int Xaxis,int Yaxis,int Zaxis)
        {
            Warehouse warehouse = new Warehouse();
            warehouse.WarehouseCode = WarehouseCode;
            warehouse.Xaxis = Xaxis;
            warehouse.Yaxis = Yaxis;
            warehouse.Zaxis = Zaxis;
            warehouse.CreatTime=DateTime.Now;
            return warehouse;
        }

    }


    //仓位
    public class WarehouseLine : Entity
    {
        [Key]
        public Guid Id_WarehouseLine { get; set; }
        public string WarehouseLineCode { get; set; }   
        public DateTime CreatTime { get; set; }
        public int Long { get; set; }
        public int Wide { get; set; }
        public int high { get; set; }
        [Comment("是否使能")]
        public bool IsEnable {  get; set; }
        [Comment("是否占用")]
        public bool IsOccupy {  get; set; }
        [Comment("排")]
        public int Xaxis { get; set; }
        [Comment("高")]
        public int Yaxis { get; set; }
        [Comment("列")]
        public int Zaxis { get; set; }
        //foreignKey
        public Warehouse TheWarehouse { get; set; }
      
        public Box? Box { get; set; }
        //function
        public WarehouseLine AddWarehouseline(int Long, int Wide, int high, int Xaxis, int Yaxis, int Zaxis, Warehouse TheWarehouse)
        {
            WarehouseLine warehouse = new WarehouseLine();
            warehouse.Long = Long;
            warehouse.TheWarehouse = TheWarehouse;
            warehouse.Wide = Wide;
            warehouse.high = high;
            warehouse.Xaxis = Xaxis;
            warehouse.Yaxis = Yaxis;
            warehouse.Zaxis = Zaxis;
            warehouse.IsEnable = true;
            warehouse.CreatTime = DateTime.Now;
            return warehouse;

        }
        public override object[] GetKeys()
        {
            return new object[] { Id_WarehouseLine };
        }

    }
}


